import React, { Component } from 'react';
import { Row,Col } from 'antd';
import './login.less';
//import { login } from './api/user'
import imgURL from './image/logo.png';

import { LoginUser } from './component/login/loginUser'

class Login extends Component{
    constructor(props){
        super(props)
        this.state = {
            form:{
                userName:'',
                passWord:''
            }
        }
        this.submitLogin = this.submitLogin.bind(this)
    }
    //生命周期函数，组件第一次被渲染到Dom中，mount(挂载)
    componentDidMount() {
        
    }
    submitLogin(){
        // login(this.state.form).then((res) => {
        //     console.log("res",res)
        //传参，如用户信息
        //     this.props.router.push({ pathname:'/index',state:res.data.data })
        // })
        
        this.props.history.push('/index')
    }   
    render(){
        return(
            <div className="login">
                <Row>
                    <Col span={17} className="layout">
                        <div className="loginBack">
                            <div className="titleLogo">
                                <img src={imgURL} alt="图标" /> 
                                <h1>公共数据</h1>
                            </div>
                            <div className="slogan">
                                <span>数据目录</span>
                                <span>资源普查</span>
                                <span>项目管理</span>
                            </div>
                        </div>
                    </Col>
                    <Col span={7} className="layout">
                        <LoginUser handleSubmit = {this.submitLogin}></LoginUser>
                    </Col>
                </Row>
              
            </div>
        )
    }
}


export default Login;